package ru.niir.goodfil.db;

import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Id;
import javax.persistence.Column;
import javax.persistence.Transient;
import java.io.Serializable;

@Entity
@Table(name = "`RestsExport`")
public class RestsExport implements Serializable
{

    //
    //  Справочник: формат выгрузки остатков
    //

    public static final String DATA_FORMAT_COLUMNS = "columns";

    public static final String DATA_FORMAT_ORDER = "order";

    //
    //  end of Справочник: формат выгрузки остатков
    //

    //
    //  Справочник: формат файла выгрузки остатков
    //

    public static final String FILE_FORMAT_EXCEL = "excel";

    public static final String FILE_FORMAT_CSV = "csv";

    //
    //  end of Справочник: формат файла выгрузки остатков
    //

    @Id
    @Column(name = "`IdClient`")
    private long clientId;

    @Column(name = "`crontab`")
    private String crontab;

    @Column(name = "`DataFormat`", length = 45)
    private String dataFormat = DATA_FORMAT_COLUMNS;

    @Column(name = "`FileFormat`", length = 45)
    private String fileFormat = FILE_FORMAT_EXCEL;

    public RestsExport()
    {
    }

    public RestsExport(long clientId, String crontab)
    {
        this.clientId = clientId;
        this.crontab = crontab;
    }

    public RestsExport(long clientId, String crontab, String dataFormat, String fileFormat)
    {
        this.clientId = clientId;
        this.crontab = crontab;
        this.dataFormat = dataFormat;
        this.fileFormat = fileFormat;
    }

    @Override
    public String toString()
    {
        return "RestsExport{" +
               "clientId=" + clientId +
               ", crontab='" + crontab + '\'' +
               ", dataFormat='" + dataFormat + '\'' +
               ", fileFormat='" + fileFormat + '\'' +
               ", client=" + client +
               ", crontabHuman='" + crontabHuman + '\'' +
               '}';
    }

    @Transient
    private Client client;

    @Transient
    private String crontabHuman;

    public long getClientId()
    {
        return clientId;
    }

    public void setClientId(long clientId)
    {
        this.clientId = clientId;
    }

    public String getCrontab()
    {
        return crontab;
    }

    public void setCrontab(String crontab)
    {
        this.crontab = crontab;
    }

    public String getDataFormat()
    {
        return dataFormat;
    }

    public void setDataFormat(String dataFormat)
    {
        this.dataFormat = dataFormat;
    }

    public String getFileFormat()
    {
        return fileFormat;
    }

    public void setFileFormat(String fileFormat)
    {
        this.fileFormat = fileFormat;
    }

    public Client getClient()
    {
        return client;
    }

    public void setClient(Client client)
    {
        this.client = client;
    }

    public String getCrontabHuman()
    {
        return crontabHuman;
    }

    public void setCrontabHuman(String crontabHuman)
    {
        this.crontabHuman = crontabHuman;
    }
}